package com.qianli.cashmama.trade.common.enums;

/**
 * Created with IntelliJ IDEA.
 * User: sm
 * Date: 2017/7/22
 * Time: 下午4:03
 */
public enum TaskStatusEnum {
    INIT(0, "初始化"),
    SUCCESS(1, "成功"),
    FAILED(2, "失败");

    private int status;
    private String desc;

    TaskStatusEnum(int status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    public static TaskStatusEnum getEnum(Integer status) {
        if (status == null) {
            return null;
        }
        for (TaskStatusEnum e : TaskStatusEnum.values()) {
            if (e.getStatus() == status) {
                return e;
            }
        }
        return null;
    }


    public int getStatus() {
        return status;
    }

    public TaskStatusEnum setStatus(int status) {
        this.status = status;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public TaskStatusEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }
}
